
<nav class="navbar navbar-default navbar-fixed-top hidden-lg hidden-md" role="navigation" nav-auto-close>
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">News Aggregator</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ng-include src="'views/includes/searchmenu.html'"></ng-include>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container-fluid -->

</nav>

<div class="container-fluid">
    <div class="row">

        <div class="col-lg-3 col-md-4 hidden-sm hidden-xs searchmenu scroll-able">
            <ng-include src="'views/includes/searchmenu.html'"></ng-include>
        </div>
        <div class="col-lg-9 col-lg-offset-3 col-md-8 col-md-offset-4 col-sm-12 content-start">
            <h3>You landed at the Newscombinator, the aggregated news reading service.</h3><br />
            <div ng-show="getResults().length == 0">Unfortunately no Results. Very bad, try again.</div>
            <div class="row story-row" ng-repeat="result in getResults()"
                 ng-init="collapsed[result.id] = true;">
                <div class="col-xs-12" ng-class='{hovering: result.showEdit}'>

                    <div class="story-content">
                        <div class="row">
                            <div class="col-xs-11" ng-click="toggleCollapsed(result);$event.stopPropagation()">
                                <a class="searchresult headline" ng-href="{{result.url}}" href=""
                                   ng-click="$event.stopPropagation()">
                                    <strong>{{result | showtitle}} </strong> <span class="text-muted"><small
                                        class="hostname">
                                    ({{result.url |
                                    gethostname}})
                                </small></span>
                                </a>


                            </div>
                            <div class="col-xs-1" ng-click="toggleCollapsed(result);$event.stopPropagation()"
                                 >
                                <button class="btn pull-right btn-default btn-xs story-collapse-button"
                                        ng-click="toggleCollapsed(result);$event.stopPropagation()"><i
                                        class=" fa"
                                        ng-class="{'fa-angle-double-up': !collapsed[result.id], 'fa-angle-double-down': collapsed[result.id]}"></i>
                                </button>
                            </div>
                            </div>
                        <div class="row">
                            <div class="col-lg-7 col-md-9" collapse="collapsed[result.id]">
                                <p class="url-content"><span>{{result.content_short_analyze}}</span>
                                    <a target="_blank" class="searchresult" ng-href="{{result.url}}" href="">[...]</a>
                                </p>
                            </div>
                            <div class="col-xs-12" ng-click="toggleCollapsed(result,true);$event.stopPropagation()">
                                <p class="url-sublinks" ng-class="{open: !collapsed[result.id]}">
                                    <small class="urls-page">

                                    <span ng-show="result.sourceitems == null || result.sourceitems.length == 0">
                                        <span title="Upvotes">{{result.hn_num_points}}
                                                <span class="fa fa-angle-up "></span>
                                            </span>
                                            <span title="Comments">{{result.hn_num_comments}}
                                                <span class="fa fa-comment-o"></span>
                                            </span>
                                        on
                                         <span class="desaturate" ng-if="result.hide_titlelinks == undefined">
                                       <span ng-repeat="sourcelink in result.source_links">
                                             <a ng-href="{{sourcelink}}" target="_blank"><img class="img-responsive img-sourceitem" ng-src="{{sourcelink | getfavicon}}" /></a>
                                        </span>
                                    </span>
                                        &bull;
                                    </span>
                                    <span ng-repeat="sourceitem in result.sourceitems">
                                        <a ng-href="{{sourceitem.sourceitem_url}}" ng-click="$event.stopPropagation()">
                                            <span title="Upvotes">{{sourceitem.sourceitem_upvotes}}
                                                <span class="fa fa-angle-up "></span>
                                            </span>
                                            <span title="Comments">{{sourceitem.sourceitem_comments}}
                                                <span class="fa fa-comment-o"></span>
                                            </span> on
                                            <img class="img-responsive img-sourceitem"
                                                 ng-src="{{sourceitem.sourceitem_url | getfavicon}}"/></a>
                                        &bull;
                                    </span>

                                        <span am-time-ago="result.created_at"
                                              tooltip="Last found {{result.created_at | date:'medium'}}">

                                    </span>



                                    <span ng-show="result.similar_doc_ids_count_i > 0" title="Similar Stories">
                                        &bull; {{result.similar_doc_ids_count_i}} <i class="fa fa-list"></i>
                                    </span>

                                        &bull; found first on {{result.source_link | gethostname:1}}


                                    </small>
                                </p>
                            </div>

                            <div class="col-lg-12 similar-stories"
                                 collapse="result.similar_docs.length == 0 || result.similar_docs == null || collapsed[result.id]">
                                <br />

                                <span ng-hide="result.similar_docs == null || result.similar_docs.length == 0">Similar
                                    Stories:
                                </span>
                                <div class="row" ng-repeat="similar in result.similar_docs">
                                    <div class="col-lg-12">
                                        <small>
                                            <a ng-href="{{similar.url}}">{{similar.title_website}}</a> <span
                                                class="text-muted"> &bull;
                                            ({{similar.url | gethostname}})</span>

                                            &bull; <span am-time-ago="similar.created_at"
                                                         tooltip="Last found {{similar.created_at | date:'medium'}}">
                                    </span>

                                    <span ng-repeat="simsource in similar.source_links"> &bull; <a
                                            ng-href="{{simsource}}"><img ng-src="{{simsource | getfavicon}}"
                                                                         class="img-responsive img-sourceitem"/></a> </span>
                                        </small>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>

            </div>

            <div infinite-scroll="nextPage()" infinite-scroll-distance="1">

            </div>
        </div>


    </div>

</div>

<div class="container text-center" ng-show="isLoading()">
    <div class="row">
        <div class="col-lg-12">
            <img src="images/ajax-loader.gif"/>
            <br/>
            <br/>
            Wait, great things are coming up.
        </div>
    </div>
</div>
